/*
 * Copyright 2010 - Jeremie Brebec
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.jb.coinche.client.gin;

import java.util.HashSet;
import java.util.Set;

import org.jb.coinche.client.business.handler.impl.GUIAuctionTurnHandler;
import org.jb.coinche.client.business.handler.impl.GUICoincheHandler;
import org.jb.coinche.client.business.handler.impl.GUIGameHandler;
import org.jb.coinche.client.business.handler.impl.GUIRoundFinishedHandler;
import org.jb.coinche.client.business.handler.impl.GUIRoundTurnFinishedHandler;
import org.jb.coinche.client.business.handler.impl.GUIRoundTurnHandler;
import org.jb.statemachine.client.GUIStateHandler;
import org.jb.statemachine.client.State;

import com.google.gwt.inject.client.AbstractGinModule;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.TypeLiteral;

public class CoincheStateHandlerModule extends AbstractGinModule {

	@Override
	protected void configure() {
		bind( new TypeLiteral<Set<GUIStateHandler<? extends State> > >() {} ).toProvider(HandlersProvider.class);
	}

	/*
	 * 
	 */
	public static class HandlersProvider implements Provider< Set<GUIStateHandler<? extends State> > > {

		@Inject
		private GUIAuctionTurnHandler h1;
		
		@Inject
		private GUIGameHandler h2;
		
		@Inject
		private GUIRoundFinishedHandler h3;
		
		@Inject
		private GUIRoundTurnFinishedHandler h4;
		
		@Inject
		private GUIRoundTurnHandler h5;
		
		@Inject
		private GUICoincheHandler h6;
		
		@Override
		public Set<GUIStateHandler<? extends State>> get() {
			HashSet< GUIStateHandler<? extends State > > set = new HashSet< GUIStateHandler<? extends State > >();
			set.add(h1);
			set.add(h2);
			set.add(h3);
			set.add(h4);
			set.add(h5);
			set.add(h6);
			return set;
		}
		
	}
	
}
